/**
 */
package org.xtext.context.aware.eventX.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtext.context.aware.eventX.EventXPackage;
import org.xtext.context.aware.eventX.RoomEvent;
import org.xtext.context.aware.eventX.TimeTable;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Room Event</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.context.aware.eventX.impl.RoomEventImpl#getEventType <em>Event Type</em>}</li>
 *   <li>{@link org.xtext.context.aware.eventX.impl.RoomEventImpl#getName <em>Name</em>}</li>
 *   <li>{@link org.xtext.context.aware.eventX.impl.RoomEventImpl#isHasTime <em>Has Time</em>}</li>
 *   <li>{@link org.xtext.context.aware.eventX.impl.RoomEventImpl#getTime <em>Time</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RoomEventImpl extends BasicEventImpl implements RoomEvent
{
  /**
   * The default value of the '{@link #getEventType() <em>Event Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEventType()
   * @generated
   * @ordered
   */
  protected static final String EVENT_TYPE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getEventType() <em>Event Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEventType()
   * @generated
   * @ordered
   */
  protected String eventType = EVENT_TYPE_EDEFAULT;

  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * The default value of the '{@link #isHasTime() <em>Has Time</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isHasTime()
   * @generated
   * @ordered
   */
  protected static final boolean HAS_TIME_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isHasTime() <em>Has Time</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isHasTime()
   * @generated
   * @ordered
   */
  protected boolean hasTime = HAS_TIME_EDEFAULT;

  /**
   * The cached value of the '{@link #getTime() <em>Time</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTime()
   * @generated
   * @ordered
   */
  protected TimeTable time;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected RoomEventImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return EventXPackage.Literals.ROOM_EVENT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getEventType()
  {
    return eventType;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setEventType(String newEventType)
  {
    String oldEventType = eventType;
    eventType = newEventType;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.ROOM_EVENT__EVENT_TYPE, oldEventType, eventType));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.ROOM_EVENT__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isHasTime()
  {
    return hasTime;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHasTime(boolean newHasTime)
  {
    boolean oldHasTime = hasTime;
    hasTime = newHasTime;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.ROOM_EVENT__HAS_TIME, oldHasTime, hasTime));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public TimeTable getTime()
  {
    if (time != null && time.eIsProxy())
    {
      InternalEObject oldTime = (InternalEObject)time;
      time = (TimeTable)eResolveProxy(oldTime);
      if (time != oldTime)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, EventXPackage.ROOM_EVENT__TIME, oldTime, time));
      }
    }
    return time;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public TimeTable basicGetTime()
  {
    return time;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTime(TimeTable newTime)
  {
    TimeTable oldTime = time;
    time = newTime;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.ROOM_EVENT__TIME, oldTime, time));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case EventXPackage.ROOM_EVENT__EVENT_TYPE:
        return getEventType();
      case EventXPackage.ROOM_EVENT__NAME:
        return getName();
      case EventXPackage.ROOM_EVENT__HAS_TIME:
        return isHasTime();
      case EventXPackage.ROOM_EVENT__TIME:
        if (resolve) return getTime();
        return basicGetTime();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case EventXPackage.ROOM_EVENT__EVENT_TYPE:
        setEventType((String)newValue);
        return;
      case EventXPackage.ROOM_EVENT__NAME:
        setName((String)newValue);
        return;
      case EventXPackage.ROOM_EVENT__HAS_TIME:
        setHasTime((Boolean)newValue);
        return;
      case EventXPackage.ROOM_EVENT__TIME:
        setTime((TimeTable)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case EventXPackage.ROOM_EVENT__EVENT_TYPE:
        setEventType(EVENT_TYPE_EDEFAULT);
        return;
      case EventXPackage.ROOM_EVENT__NAME:
        setName(NAME_EDEFAULT);
        return;
      case EventXPackage.ROOM_EVENT__HAS_TIME:
        setHasTime(HAS_TIME_EDEFAULT);
        return;
      case EventXPackage.ROOM_EVENT__TIME:
        setTime((TimeTable)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case EventXPackage.ROOM_EVENT__EVENT_TYPE:
        return EVENT_TYPE_EDEFAULT == null ? eventType != null : !EVENT_TYPE_EDEFAULT.equals(eventType);
      case EventXPackage.ROOM_EVENT__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
      case EventXPackage.ROOM_EVENT__HAS_TIME:
        return hasTime != HAS_TIME_EDEFAULT;
      case EventXPackage.ROOM_EVENT__TIME:
        return time != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (eventType: ");
    result.append(eventType);
    result.append(", name: ");
    result.append(name);
    result.append(", hasTime: ");
    result.append(hasTime);
    result.append(')');
    return result.toString();
  }

} //RoomEventImpl
